package com.qidianit.mes.device.controller;

import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.device.service.DeviceWorkShopService;
import com.qidianit.mes.pojo.DeviceWorkshop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/deviceWork")
@CrossOrigin
public class DeviceWorkShopController {


    @Autowired
    DeviceWorkShopService deviceWorkShopService;
    @GetMapping("/list")
    public MESResult list(
            @RequestParam(defaultValue = "1")int page,
            @RequestParam(defaultValue = "10")int limit) {
        MESResult mesResult = deviceWorkShopService.list();
        return mesResult;
    }

    @PostMapping("/add")
    public MESResult add(@RequestBody DeviceWorkshop deviceWorkshop){
        return deviceWorkShopService.add(deviceWorkshop);
    }
    @PostMapping("/edit")
    public MESResult edit(@RequestBody DeviceWorkshop deviceWorkshop){
        return deviceWorkShopService.edit(deviceWorkshop);
    }
    @DeleteMapping("/delete")
    public MESResult delete(String id){
        return deviceWorkShopService.delete(id);
    }
}
